package com.frejoys.app.controller;

import com.frejoys.common.aop.Authority;
import com.frejoys.common.aop.Authorization;
import com.frejoys.common.constant.CommonConstant;
import com.frejoys.common.response.Result;
import com.frejoys.common.vo.ad.UserAdVo;
import com.frejoys.service.AdService;
import com.frejoys.service.VoiceMessageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author wangzhicheng
 * @version 1.0
 * @date 2024/5/6 10:16
 */
@Tag(name = "轮播图", description = "轮播图")
@RestController
@RequiredArgsConstructor
@RequestMapping(CommonConstant.routePrefixApp)
 @Authorization(Authority.Private)
public class AdController {

    private final AdService adService;

    // private final VoiceMessageService voiceMessageService;

    // @Authorization(Authority.Public)
    // @GetMapping("/test/ttt")
    // public Result ttt() {
    //     voiceMessageService.voicePlay(13369769516470272L);
    //     return Result.success();
    // }

    /**
     * 用户查询广告
     */
    @Authorization(Authority.Protected)
    @Operation(summary = "查询首页广告")
    @PostMapping("/ad/listAd")
    public Result<List<UserAdVo>> listAd() {
        return Result.success(adService.listAd());
    }
}
